<template>
  <div class="el-breadcrumb">
    <span v-for="item in breadcrumb" :key="item.path" class="el-breadcrumb__item">
      <span v-if="item.err" class="el-breadcrumb__inner nowrap">{{ item.label }}</span>
      <router-link v-else :to="item.path" class="el-breadcrumb__inner is-link">
        {{ item.label }}
      </router-link>
      <span v-if="!separatorClass" class="el-breadcrumb__separator">/</span>
      <i v-else class="el-breadcrumb__separator" :class="separatorClass"></i>
    </span>
    <slot></slot>
  </div>
</template>

<script>
export default {
  name: 'ws-breadcrumb', // 自行编写的以a标签为跳转的面包屑，需要el-element支持
  props: {
    breadcrumb: { // [{ path: xx, label: xx }]
      type: Array,
      required: true,
    },
    separatorClass: {
      type: String, // 分隔符
      default: undefined,
    },
  },
};
</script>

<style></style>
